package com.hzit.servlet;



import org.omg.PortableInterceptor.ServerIdHelper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {

	@Override
	public void init() throws ServletException {
		System.out.println("init...");
	}

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//1. 处理post请求的中文乱码
		req.setCharacterEncoding("UTF-8");
		//2. 处理响应的字符集编码
		resp.setContentType("text/html;charset=utf8");

	}

	@Override
	public void destroy() {
		System.out.println("destroy...");
	}
}
